package eecs285.proj4.gui;

//Class: EECS 285
//Project: 
//Due Date: Monday December 6th, 2010

//NOTES: 

import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Point;

import static eecs.util.Utility.*;

/**
 * A derived class for actions performed on a Markerboard.
 * 
 * @author Easton Thomas
 * @author Stubbed by Hans Marquard
 */
@SuppressWarnings("serial")
public class Line extends MAction
{

  // ---------------------------------------------------------------------------

  /**
   * Constructor.
   * 
   * @author Hans Marquard
   */
  public Line(Point start_, Point end_)
  {
    super(TYPE.LINE);
    start_pt = start_;
    end_pt = end_;
    
  }
  
  // ---------------------------------------------------------------------------

  /**
   * Include an additional Point in the mouse movement.
   * 
   * @author Hans Marquard
   */
  public void add_point(Point new_point)
  {
	  end_pt = new_point;
  }

  // ---------------------------------------------------------------------------

  /**
   * Implementation of abstract draw method. Draws this type of object.
   * 
   * @param g2
   *          The Graphics object to draw on.
   * @author Easton Thomas
   * @author Stubbed by Hans Marquard
   */
  public void draw(Graphics2D g2)
  {
	g2.setColor(color);
    g2.setStroke(new BasicStroke(stroke, BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND)); // set line width of Line
    g2.drawLine(start_pt.x, start_pt.y, end_pt.x, end_pt.y);
  }// draw

}// Line
